#include <algorithm>
#include <cstdio>
using namespace std;
const int py = 1001;
int n;
char opt[5];
char map[py << 1][py << 1];
int x, y;
char c;
int row = py, col = py;
inline void move(int x, int y) {
	col += x;
	row += y;
}
int main() {
	freopen("one.in", "r", stdin);
	freopen("one.out", "w", stdout);
	scanf("%d", &n);
	while (n--) {
		scanf("%s", opt);
		switch (opt[0]) {
		case 'm':
			scanf("%d %d", &x, &y);
			move(x, y);
			break;
		case 's':
			getchar();
			c = getchar();
			map[col][row] = c;
			break;
		case 'q':
			if (map[col][row] == '\000')
				printf("nothing\n");
			else
				printf("%c\n", map[col][row]);
			break;
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}